package com.guigu.zj.controller;

import com.guigu.pojo.Motion;
import com.guigu.zj.pojo.MpageVo;

import com.guigu.zj.service.MotionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MotionController {
    @Autowired
    MotionService motionService;
    @RequestMapping("/Z_motionAll")
    public MpageVo<Motion> motionAll(@RequestBody MpageVo<Motion> mpageVo){
        return motionService.queryAll(mpageVo);
    }
    @RequestMapping("/Z_motionAdd")
    public int add(@RequestBody Motion motion){
        return motionService.insertSelective(motion);
    }
    @RequestMapping("/Z_motionById")
    public Motion motionById(@RequestBody Motion motion){
        return motionService.selectByPrimaryKey(motion.getId());
    }

    @RequestMapping("Z_motionUp")
    public int motionUp(@RequestBody Motion motion){
        return  motionService.updateByPrimaryKeySelective(motion);
    }
    @RequestMapping("Z_motionDel")

    public int motionDel(Integer id){
       return motionService.deleteByPrimaryKey(id);
    }
}
